import 'package:my_blog_flutter/app/modules/home_detail/models/home_detail_entity.dart';
import 'package:my_blog_flutter/generated/json/base/json_convert_content.dart';


HomeDetailEntity $HomeDetailEntityFromJson(Map<String, dynamic> json) {
  final HomeDetailEntity homeDetailEntity = HomeDetailEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    homeDetailEntity.code = code;
  }
  final String? message = jsonConvert.convert<String>(json['message']);
  if (message != null) {
    homeDetailEntity.message = message;
  }
  final HomeDetailData? data = jsonConvert.convert<HomeDetailData>(
      json['data']);
  if (data != null) {
    homeDetailEntity.data = data;
  }
  final int? timestamp = jsonConvert.convert<int>(json['timestamp']);
  if (timestamp != null) {
    homeDetailEntity.timestamp = timestamp;
  }
  return homeDetailEntity;
}

Map<String, dynamic> $HomeDetailEntityToJson(HomeDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['message'] = entity.message;
  data['data'] = entity.data?.toJson();
  data['timestamp'] = entity.timestamp;
  return data;
}

extension HomeDetailEntityExtension on HomeDetailEntity {
  HomeDetailEntity copyWith({
    int? code,
    String? message,
    HomeDetailData? data,
    int? timestamp,
  }) {
    return HomeDetailEntity()
      ..code = code ?? this.code
      ..message = message ?? this.message
      ..data = data ?? this.data
      ..timestamp = timestamp ?? this.timestamp;
  }
}

HomeDetailData $HomeDetailDataFromJson(Map<String, dynamic> json) {
  final HomeDetailData homeDetailData = HomeDetailData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    homeDetailData.id = id;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    homeDetailData.title = title;
  }
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    homeDetailData.content = content;
  }
  final int? userId = jsonConvert.convert<int>(json['userId']);
  if (userId != null) {
    homeDetailData.userId = userId;
  }
  final int? rateNumber = jsonConvert.convert<int>(json['rateNumber']);
  if (rateNumber != null) {
    homeDetailData.rateNumber = rateNumber;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    homeDetailData.createTime = createTime;
  }
  final dynamic updateTime = json['updateTime'];
  if (updateTime != null) {
    homeDetailData.updateTime = updateTime;
  }
  final int? state = jsonConvert.convert<int>(json['state']);
  if (state != null) {
    homeDetailData.state = state;
  }
  return homeDetailData;
}

Map<String, dynamic> $HomeDetailDataToJson(HomeDetailData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['title'] = entity.title;
  data['content'] = entity.content;
  data['userId'] = entity.userId;
  data['rateNumber'] = entity.rateNumber;
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  data['state'] = entity.state;
  return data;
}

extension HomeDetailDataExtension on HomeDetailData {
  HomeDetailData copyWith({
    int? id,
    String? title,
    String? content,
    int? userId,
    int? rateNumber,
    String? createTime,
    dynamic updateTime,
    int? state,
  }) {
    return HomeDetailData()
      ..id = id ?? this.id
      ..title = title ?? this.title
      ..content = content ?? this.content
      ..userId = userId ?? this.userId
      ..rateNumber = rateNumber ?? this.rateNumber
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime
      ..state = state ?? this.state;
  }
}